<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>

		<title>广东科学技术职业学院考生报到系统>>>>招就处</title>
	<base href="<%=basePath%>">
		<!--[if lte IE 6]></base><![endif]-->
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
			<link rel="stylesheet" href="css/jquery-ui-1.8.5.custom.css" type="text/css" />
			<link href="css/newindex.css" rel="stylesheet" type="text/css" />
			<script src="js/jquery-1.5.js" language="javascript">
</script>
		<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/excanvas.min.js"></script><![endif]-->
			<script src="js/newpublic.js" language="javascript">
</script>
		<script src="js/jquery-ui-1.8.5.custom.min.js" language="javascript">
</script>

		<script language="javascript" type="text/javascript"
			src="js/jquery.flot.js">
</script>

<!-- 下面是饼图所要用到的两个文件 -->
		<script type="text/javascript" src="js/jquery.flot.pie.min.js">
</script>
		<script type="text/javascript" src="js/Pie-chart.js">
</script>

<script>
var registerBarchart = new PieChart();
var paymentBarchart = new PieChart();
var num = 0;
$(function() {
	$("#content").draggable({cancel:".contable"});
	//默认执行
	updateRate();
	var areaJson =<s:property value="areaJson" escape="false"/>	
	var campusJson = <s:property value="campusJson" escape="false"/>	
	var subjectsJson =<s:property value="subjectsJson" escape="false"/>	
	initSelect(campusJson,areaJson,subjectsJson)//初始化校区，地区，科目
})
	var t;
	//更新
	function updateRate(){
				$.post("json/queryLeaderToSchoolAction",{'campusName':$('#campusName').val(),'area':$('#areaName').val() ,'subjects':$('#subjectName').val(),date:new Date()},function(data){
						
						data=eval("("+data.result+")");
						fillQueryResult(data);
				})
			window.clearTimeout(t);
			t = window.setTimeout(function(){updateRate()},30000)
	}
	//更新
	/*function updataPayment(){
		$.post("json/queryLeaderToSchoolPaymentAction",{'campusName':$('#campusName1').val(),'area':$('#areaName1').val() ,'subjects':$('#subjectName1').val(),date:new Date()},function(data){
						
						data=eval("("+data.paymentResult+")");
						fillFaymentResult(data);
				})
				t1 = window.setTimeout(function(){updataPayment()},1200)
				
	}*/
	
	//初始化下拉列表
	function initSelect(campusJson,areaJson,subjectsJson)
		{
			if(campusJson!=null){
				$("#campusName").empty();
				$("#campusName").append("<option value=''>全部</option>");
				for(campus in campusJson){
					$("#campusName").append("<option value='"+campus+"'>"+campusJson[campus]+"</option>");
				}
			}
		
			if(areaJson!=null){
				$("#areaName").empty();
				$("#areaName").append("<option value=''>全部</option>");
				for(area in areaJson){
					$("#areaName").append("<option value='"+area+"'>"+areaJson[area]+"</option>");
				}
			}
			
			if(subjectsJson !=null){
				$("#subjectName").empty();
				$("#subjectName").append("<option value=''>全部</option>");
				for(subjects in subjectsJson){
					$("#subjectName").append("<option value='"+subjects+"'>"+subjectsJson[subjects]+"</option>");
				}
				
			}
			
		}
		
		//填充缴费结果
		/*function fillFaymentResult(data){
			//alert(data);
			$("#totalAmount").html(data.totalAmount);
			$("#paymentDue").html(data.paymentDue);
			$("#feesPaid").html(data.feesPaid);
			$("#delinquentAmounts").html(data.delinquentAmounts);
			$("#feesPaidCounts").html(data.feesPaidCounts);
		}*/
		
		//填充查询结果
	
		function fillQueryResult(data)
		{
			//alert(data);
			//alert(data.registeredCount);
			$("#registerNumber").html(data.registeredCount);
			$("#studentCount").html(data.studentCount);
			registerBarchart.buildPieChart($("#placeholderForBars"),{'未报到' : (1 - data.registerRate),'已报到' :data.registerRate},null);
			//for(i in data)
				//alert(data[i].)
		}
		
</script>

	</head>

	<body onload="fixPNGAll()">
		<div id="bg">
			<div id="bodydiv">
				<div id="bodytitle"> 
					招就处
					<div>
						<a href="logoutAction" style="color: #F00;">退出</a>
					</div>
				</div>
				<div id="menudiv">

					<jsp:include page="entrance_header.jsp" />

				</div>
				<div id="content">
					<!--当前位置CSS-->
					<div class="top">
						<div class="topleft">
							<div class="dan">
								<div>
								当前位置>招就处>学校报到率
								</div>
							</div>
							<div class="F5">
								<img src="newimages/F5.png" />
							</div>
						</div>
						<div class="topright">
							<div class="toprightmin"></div>
							<div class="toprightmax"></div>
							<div class="toprightclose" onclick="if(confirm('是否确定退出！')){location.replace('loginoutAction')}" title="点击退出"></div>
						</div>
					</div>
					<!---->
					<!--内容-->
					<div class="condiv">
							<div class="submenu">

						</div>
						<div class="contable">
							<!--******************************-->
							<div id="t1" style="display: block;">
								<div class="title">
									学校报到率
								</div>

								
								<table width="60%" border="0" align="center" cellpadding="1"
									cellspacing="0">
									<tr>
										<td colspan="2" align="right" valign="middle">

											<table width="280" border="0" cellspacing="5" cellpadding="0"
												style="letter-spacing: 2px;">
												<tr>
													<td height="23" align="right">
														校区：
													</td>
													<td width="116" align="left">
														<select id="campusName">
															<option>
																全部
															</option>
															
														</select>
													</td>
													<td></td>
												</tr>
												<tr>
													<td height="23" align="right">
														地区：
													</td>
													<td align="left">
														<select name="areaName" id="areaName">
															<option>
																全省
															</option>
														</select>
													</td>
													<td></td>
												</tr>
												<tr>
													<td height="23" align="right">
														科目：
													</td>
													<td align="left">
														<select id="subjectName">
															<option>
																全部
															</option>
														</select>
													</td>
													<td><input name="" type="button" value="确定" onclick="updateRate()" /></td>
												</tr>
												<tr>
													<td colspan="2" align="center">
														<div
															style="border: 1px dotted #060; width: 180px; margin-left: auto; margin-right: auto;">
															<div style="font-size: 16px; color: red;">
																即时报到人数
															</div>
																<h2 id="registerNumber">0</h2>
														</div>
													</td>
													<td></td>
												</tr>

												<tr>
													<td align="right" style="font-size: 16px;">
														总人数:
													</td>
													<td align="left" style="font-size: 16px;">
														<h4 id="studentCount" style="margin-top: auto;margin-bottom: auto">0</h4>
													</td>
													<td></td>
												</tr>
											</table>


										</td>
										<td width="50%" align="left">
											<div style="width: 90%">
												<div id="placeholderForBars" style="width: 380px; height: 350px; float: left;"></div>
											</div>
										</td>
									</tr>
								</table>
							</div>
							<!-------**********************************-------->
							
							<!----------------------------------------------->
						</div>
					</div>
					<!---->
					<!---->
					<div class="condiv"
						style="width: 997px; position: relative; height: 20px; min-height: 20px; text-align: center;">
						<a href="computer/computer.html" target="_blank">计算机学院程序员之家</a>
					</div>
					<!---->

					<!--低部-->
					<div class="bottom">
						&nbsp;
					</div>
					<!---->
				</div>
			</div>
		</div>
	</body>
</html>
